package com.lbc.controller;

import com.lbc.common.resp.ResponseResult;
import com.lbc.service.MessageBoardService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author xyl
 * @date 2021-03-29 10:00
 */
@Api(tags = "留言板接口")
@RequestMapping("/messageBoard")
@RestController
public class MessageBoardController {

    @Autowired
    private MessageBoardService messageBoardService;

    @PostMapping(value = "add")
    public ResponseResult add(String content) {
        return ResponseResult.toResponse(messageBoardService.add(content));
    }

    @GetMapping("list")
    public ResponseResult list(){
        return ResponseResult.success(messageBoardService.list());
    }
}
